package com.zoe.app.filters.filter;

import com.zoe.app.context.BaseContext;
import com.zoe.app.filters.BaseFilter;

/**
 * @author zbg
 * @date 2023/06/06
 * @description
 */
public abstract class AbsFilter<C extends BaseContext> implements BaseFilter<C> {
    @Override
    public String getFilterName() {
        return this.getClass().getSimpleName();
    }

    @Override
    public final void doFilter(C ctx) {
        if (ctx.getFilterSelector().match(getFilterName())) {
            handler(ctx);
        }
    }
}
